<template>
	<view class="index1_content">

		<WebView v-if="isOnShow && (identity_type===2||identity_type===5 || identity_type===6 || identity_type===7)" />
		<!-- 司机工作台 -->
		<WebView v-else-if="isOnShow && ( identity_type===8)" propsUrl="/pages/driverTask/index"></WebView>
		<!-- <onlineWork v-else :identity_type="identity_type" ref="onlineRef"></onlineWork> -->
		<WebViewShop v-else :propsUrl="`/pages/onlineWork/index`" :identity_type="identity_type"></WebViewShop>

			<!-- 0	供应商 
		1	经销商
		2	货代公司 1
		3	采购商
		4	服务公司
		5	报关公司
		6	运输公司 1
		7	国际物流公司
		8	司机
		9	服务商
		10	俄罗斯个人 -->
	</view>
</template>

<script>

	import IndexVue from './home.vue'
	import WebView from "@/pages/zWebView/zWebView"
	import WebViewShop from "@/pages/zWebViewShop/zWebViewShop"

	import onlineWork from "./components/onlineWork"

	export default {
		components: {
			WebView,IndexVue,onlineWork,WebViewShop
		},
		data() {
			return {
				isOnShow: false, //刷新加载的子组件
				identity_type: '', //角色id
			}
		},
		onShow() {
			this.getLang()
			let identity_type = uni.getStorageSync('userInfoFull');
			this.identity_type = identity_type.identity_type
			this.isOnShow = false;
			this.$nextTick(() => {
				this.isOnShow = true;
				if (this.$refs.onlineRef) {
					console.log(this.$refs.onlineRef,'this.$refs.onlineRef')
					this.$refs.onlineRef.getOnShow();
				}
			});
			this.$forceUpdate();
		},
		created() {
			this.isOnShow = false;
			this.$nextTick(() => {
				this.isOnShow = true;
			});
		},
		methods: {
			getLang() {
				// 获取缓存lang当前语言值
				uni.getStorage({
					key: 'lang',
					success: res => {
						if (res.data == 'zh') { //zh为中国，赋值0
							this.lang = 'zh'
						} else { //其他为俄罗斯，赋值1
							this.lang = 'ru'
						}
					}
				});
			},
		}
	}
</script>

<style scoped>
	.index1_content {
		width: 100%;
		height: calc(100%);
		height: calc(100% - constant(safe-area-inset-top));
		height: calc(100% - env(safe-area-inset-top));
		/* #ifdef APP-PLUS */
		height: calc(100vh);
		height: calc(100vh - constant(safe-area-inset-top));
		height: calc(100vh - env(safe-area-inset-top));
		/* #endif */
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	page {
		background-color: #F1F2F4;
	}
</style>